<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="lib/vue.min.js"></script>
    <style>
        .current{
            color: red;
        }
    </style>
</head>
<body>
<div id="app">
    <fruit-list :list="list">
        <template slot-scope='slotProps'>
            {{slotProps}}
            <strong v-if='slotProps.info.id==2' class="current">{{slotProps.info.name}}</strong>
            <span v-else>{{slotProps.info.name}}</span>
        </template>
    </fruit-list>
</div>
<script>
    // 作用域插槽
    Vue.component('fruit-list',{
        props:['list'],
        template: `
        <div>
          <li :key='item.id' v-for='item in list'>
            <slot :info='item'>{{item.name}}</slot>
          </li>
        </div>
      `
    })
    var vm=new Vue({
        el:'#app',
        data:{
            list:[
                {id:1,name:'apple'},
                {id:2,name:'orange'},
                {id:3,name:'purple'}
            ]
        },
        methods:{}
    })
</script>
</body>
</html>
